************************** Hypothesis 1 **********************
********************** Trust in the Military *****************

drop if q19_grupo==88
drop if q19_grupo==99

*multinomial logistic regression
mlogit q19_grupo i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects (gender)
margins, dydx(sexo) pr(out(1))
marginsplot, title("") subtitle("Fully or" "a lot") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(trustdy1)

margins, dydx(sexo) pr(out(2))   
marginsplot, title("") subtitle("  " "Reasonably") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(75) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(trustdy2)

margins, dydx(sexo) pr(out(3))   
marginsplot, title("") subtitle("Little or" "nothing") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(75) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(trustdy3)

gr combine trustdy1 trustdy2 trustdy3, title("1a. Do you trust the military?", size(medium)) graphregion(color(white)) col(3) ycommon name(trustdy_all) 



************************* Hypothesis 2a **********************
********************** Military Expenditures *****************

drop if q29_grupo==88
drop if q29_grupo==99

*multinomial logistic regression
mlogit q29_grupo i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Increase a lot" "or reasonably") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(expenddy1)

margins, dydx(sexo) pr(out(2))   
marginsplot, title("") subtitle("Remain" "the same") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(expenddy2)

margins, dydx(sexo) pr(out(3))   
marginsplot, title("") subtitle("Decrease" "reasonably or a lot") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(expenddy3)

gr combine expenddy1 expenddy2 expenddy3, title("1b. Expenditures with military equipment should...", size(medium)) graphregion(color(white)) col(3) ycommon name(expenddy_all) 



********************** Hypothesis 2b **********************
********************** Arms industry **********************

drop if q30==88
drop if q30==99

*multinomial logistic regression
mlogit q30 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Yes, Brazilian" "companies only") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(indusdy1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("Yes, Brazilian or" "foreign companies") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(indusdy2)

margins, dydx(sexo) pr(out(3))     
marginsplot, title("") subtitle("  " "Not important") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(indusdy3)

gr combine indusdy1 indusdy2 indusdy3, title("1c. Is an arms industry" "in Brazil important?", size(medium)) graphregion(color(white)) col(3) ycommon name(indusdy_all) 



*************************** Hypothesis 3 ***********************
********************** The military and crime ******************

drop if q33==88
drop if q33==99

*multinomial logistic regression
mlogit q33 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("  " "Yes, always") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(crimedy1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("  " "Yes, occasionaly") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(crimedy2)

margins, dydx(sexo) pr(out(3))     
marginsplot, title("") subtitle("  " "Never") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("Male") fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(crimedy3)

gr combine crimedy1 crimedy2 crimedy3, title("1d. Should the military" "combat crime?", size(medium)) graphregion(color(white)) col(3) ycommon name(crimedy_all) 



******************** FIGURE 1 *********************

gr combine trustdy_all expenddy_all indusdy_all crimedy_all, ///
graphregion(color(white)) col(2) ycommon 



************************ Hypothesis 4a ***********************
********************** Military service **********************

drop if q35==88
drop if q35==99

*multinomial logistic regression
mlogit q35 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Yes, military" "service only") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(servicody1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("Yes, military or" "civilian service") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(servicody2)

margins, dydx(sexo) pr(out(3))     
marginsplot, title("") subtitle("Only" "voluntary service") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(servicody3)

margins, dydx(sexo) pr(out(4))     
marginsplot, title("") subtitle("No, even if" "voluntary") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(servicody4)

gr combine servicody1 servicody2 servicody3 servicody4, title("2a. Do you suport conscription?", size(medium)) 
graphregion(color(white)) col(4) ycommon name(servicody_all) 



**************************** Hypothesis 4b ***********************
********************** Collaboration in case of war **************

drop if q21==88
drop if q21==99

*multinomial logistic regression
mlogit q21 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(4)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("As a soldier," "in combats") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(wardy1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("As a soldier," "not in combats") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(wardy2)

margins, dydx(sexo) pr(out(3))     
marginsplot, title("") subtitle("  " "As a civilian") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(wardy3)

margins, dydx(sexo) pr(out(4))     
marginsplot, title("") subtitle("  " "No") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor(black) m(large)) graphregion(margin(tiny)) name(wardy4)

gr combine wardy1 wardy2 wardy3 wardy4, title("2b. Would you be willing to participate in a war?", size(medium)) ///
graphregion(color(white)) col(4) ycommon name(wardy_all) 



********************** FIGURE 2 ************************
gr combine servicody_all wardy_all, graphregion(color(white)) col(2) 



*************************** Hypothesis 5 ***********************
********************** LGBTQ in the military *******************

drop if q37==88
drop if q37==99

*multinomial logistic regression
mlogit q37 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(2)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Yes") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(homody1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("No") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(87) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(homody2)

gr combine homody1 homody2, title("3a. Should homosexuals be" "allowed to join the military?", size(medium)) ///
graphregion(color(white)) col(2) ycommon name(homody_all) 



******************************** Hypothesis 6 ***********************
********************** Participation in UN Peacekeeping *************

drop if q31==88
drop if q31==99

*multinomial logistic regression
mlogit q31 i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(2)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Yes") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(peacedy1)

margins, dydx(sexo) pr(out(2))     
marginsplot, title("") subtitle("No") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(87) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(peacedy2)

gr combine peacedy1 peacedy2, title("Should the military participate" "in UN peacekeeping operations?", size(medium)) ///
graphregion(color(white)) col(2) ycommon name(peacedy_all) 



****************************** Hypothesis 7a ***********************
********************** Threats because of the Amazon ***************

drop if q23_grupo==88
drop if q23_grupo==99

*multinomial logistic regression
mlogit q23_grupo i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Fully or" "a lot") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(amazondy1)

margins, dydx(sexo) pr(out(2))   
marginsplot, title("") subtitle("  " "Reasonably") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(amazondy2)

margins, dydx(sexo) pr(out(3))   
marginsplot, title("") subtitle("Little or" "does not believe") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(amazondy3)

gr combine amazondy1 amazondy2 amazondy3, title("3c. Do you believe that Brazil will be" "militarily attacked in the future because of the Amazon?", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(amazondy_all) 



*************************** Hypothesis 7b ***********************
********************** Foreign NGOs in the Amazon ***************

drop if q26_grupo==88
drop if q26_grupo==99

*multinomial logistic regression
mlogit q26_grupo i.sexo i.q3_grupo i.q1_grupo i.q2_grupo_alt2 i.q10_grupo i.regiao ///
i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*marginal effects
margins, dydx(sexo) pr(out(1))     
marginsplot, title("") subtitle("Very positive" "or positive") ///
ytitle("Marginal effect") yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(100) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(ONGSdy1)

margins, dydx(sexo) pr(out(2))   
marginsplot, title("") subtitle("Neither positive" "nor negative") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(ONGSdy2)

margins, dydx(sexo) pr(out(3))   
marginsplot, title("") subtitle("Negative or" "very negative") ///
ytitle("Marginal effect") yscale(off) yline(0, lpattern(shortdash) lcolor(black)) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
fxsize(80) graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(margin(tiny)) name(ONGSdy3)

gr combine ONGSdy1 ONGSdy2 ONGSdy3, title("3d. What do you think about the influence of" "foreign NGOs in the Amazon?", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(ONGSdy_all) 


*********************** FIGURE 3 ************************
gr combine homody_all peacedy_all amazondy_all ONGSdy_all, ///
graphregion(color(white)) col(2) ycommon 